const { ref } = Vue;
import { useFetch } from '../../Scripts/hooks/useFetch.js'

export function useUserRoles() {
  const userList = ref([]);

  // 查询用户信息
  const getFactoryUsersByRoleName = async configObj => {
    const { data } = await useFetch({
      url: `${configObj.url}?actions=${configObj.method}`,
      data: {
        type: `${configObj.method}`,
        factoryid: `${configObj.factoryid}`,
        rolename: `${configObj.rolename}`
      }
    });
    userList.value = data.value;
  }

  return { userList, getFactoryUsersByRoleName }
}